*******************************************************
* Lyle 05 Jan 11: 						              *
*	-this program serves as a base shell for all	  *
*	 stata do files					                  *
*******************************************************


********************************
* Standard Stata Configuration *
********************************
clear all
set mem 999m
capture log close
set logtype text
cap cd "C:\Users\ejm5\Google Drive\2016_Research\Unemployment_MILEX"
cap cd "C:\Users\Jordan.Becker\Desktop\GD\2016_Research\Unemployment_MILEX"
cap cd "\\usnatonetapp01.eur.state.sbu\profiles\beckerjm\Desktop\2016_Research\Unemployment_MILEX"
log using "log\correlates_table2.log", replace


*********************
* Prepare Variables *
*********************
use "dta\2016_02_09_uem", clear
sort ccode year
xtset ccode year


********************
* Analyze the Data *
********************
set more off
sort ccode year
xtset ccode year


*************DEPLOYABILITY*******************************************************************************
*Figure 2a: Bivariate Relationship between Military Burden and EDA Deployability*
#delimit;
use "dta\2016_02_09_uem", clear;
sort ccode year;
xtset ccode year;
preserve;
keep if eda_deployability!=.;
#delimit;
twoway (lfit eda_deployability l3.milburden) 
(scatter eda_deployability l3.milburden, msymbol(diamond) mcolor(navy) msize(medsmall)),
xtitle("", size(medsmall) margin(medsmall))
ytitle("", size(small) margin(medsmall))
legend(rows(2) size(vsmall) position(2) ring(0) label(1 Fitted) label(2 Observed))
title("A: All Country-Years (3-year lag on DV)", size(medlarge));
graph save output\milburden_deployability_a.gph, replace;
restore;


*Figure 2b: Mean Bivariate Relationship between Military Burden and EDA Deployability*
#delimit;
preserve;
keep if eda_deployability!=.;
collapse milburden eda_deployability, by (countryname);

#delimit;
twoway (lfit eda_deployability milburden) 
(scatter eda_deployability milburden, msymbol(diamond) mcolor(navy) msize(medsmall) mlabsize(vsmall) mlabcolor(black) mlabel(countryname)),
xtitle("", size(medsmall) margin(medsmall))
ytitle("", size(medium) margin(medsmall))
legend(off)
title("B: Mean 2006-2014", size(medlarge));

graph save output\milburden_deployability_b.gph, replace;

#delimit;
graph combine output\milburden_deployability_a.gph output\milburden_deployability_b.gph, 
cols(3) ycommon iscale(tiny) imargin(tiny)
title("Defense Spending (%GDP)", size(medlarge) margin(medsmall) color(black) position(6))
subtitle("EDA Deployability (Deployable Land Forces/Total Military Personnel)", size(vsmall) position(9) orientation(vertical) margin(medsmall) color(black));
graph save output\milburden_deployability, replace;
restore;
